xenial(16.04) – matoken's blog https://matoken.org/blog Is there no plan B? Tue, 11 Dec 2018 20:32:22 +0000 ja hourly 1 https://wordpress.org/?v=6.8.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg xenial(16.04) – matoken's blog https://matoken.org/blog 32 32 Nextcloud を 15 にアップグレードしようとしてコケる https://matoken.org/blog/2018/12/12/failure-trying-to-upgrade-nextcloud-to-15/ https://matoken.org/blog/2018/12/12/failure-trying-to-upgrade-nextcloud-to-15/#respond Tue, 11 Dec 2018 20:29:47 +0000 http://matoken.org/blog/?p=2262 20181212_05:12:42-18746

Nextcloud 15 がリリースされました.

14.0.4 からアップグレードしようとしましたが失敗しました.そのメモです.

$ sudo -u www-data php7.0 ./occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
UnexpectedValueException: The files of the app "user_external" were not correctly replaced before running the update
Update failed
Maintenance mode is kept active
Reset log level

整合性が保たれていないようなので手動でアーカイブを入手して比較すると同じに見える

$ wget https://download.nextcloud.com/server/releases/nextcloud-15.0.0.tar.bz2 https://download.nextcloud.com/server/releases/nextcloud-15.0.0.tar.bz2.asc
$ gpg --verify ./nextcloud-15.0.0.tar.bz2.asc
gpg: 署名されたデータが'./nextcloud-15.0.0.tar.bz2'にあると想定します 
gpg: 2018年12月10日 19時27分11秒 JSTにRSA鍵ID A724937Aで施された署名
gpg: "Nextcloud Security <security@nextcloud.com>"からの正しい署名
gpg: *警告*: この鍵は信用できる署名で証明されていません!
gpg:          この署名が所有者のものかどうかの検証手段がありません。 
主鍵フィンガー・プリント: 2880 6A87 8AE4 23A2 8372  792E D758 99B9 A724 937A
$ tar tvf ./nextcloud-15.0.0.tar.bz2 | lv
$ tar xf ./nextcloud-15.0.0.tar.bz2
$ sudo -u www-data rsync -acvvn ./nextcloud/apps/user_external /var/www/home.matoken.org/nextcloud/apps/
sending incremental file list
delta-transmission disabled for local transfer or --whole-file
user_external/
user_external/appinfo/app.php is uptodate
user_external/appinfo/database.xml is uptodate
user_external/appinfo/info.xml is uptodate
user_external/appinfo/signature.json is uptodate
user_external/img/app.svg is uptodate
user_external/lib/base.php is uptodate
user_external/lib/ftp.php is uptodate
user_external/lib/imap.php is uptodate
user_external/lib/smb.php is uptodate
user_external/lib/webdavauth.php is uptodate
total: matches=0  hash_hits=0  false_alarms=0 data=0

sent 515 bytes  received 587 bytes  2,204.00 bytes/sec
total size is 19,690  speedup is 17.87 (DRY RUN)

このあたりのバグぽい

ちなみに user_external はFTP, IMAP, SMB の認証周りのよう.

Authenticate user login against FTP, IMAP or SMB.

とりあえず該当の user_external を無効にしてアップグレードは通った

$ sudo -u www-data php7.0 ./occ app:disable user_external
$ sudo -u www-data php7.0 ./occ upgrade

通ったけど無効にしていても怒られる

Some files have not passed the integrity check. Further information on how to resolve this issue can be found in the documentation. (List of invalid files… / Rescan…)

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- user_external
    - EXTRA_FILE
        - user_external/appinfo/signature.json

Raw output
==========
Array
(
    [user_external] => Array
        (
            [EXTRA_FILE] => Array
                (
                    [user_external/appinfo/signature.json] => Array
                        (
                            [expected] => 
                            [current] => 37efcee67605ab01a595df9b8e37a63f0260a8d795cb4af9b1b40e137ace928193747445954b22455fcbfd1758ea9b663153afc73438f5370725682e344c8723
                        )

                )

        )

)

まだ非対応アプリも多いしメイン環境は暫く待ったほうが良さそうな感じです.

環境

$ sudo -u www-data php7.0 ./occ status -v
  - installed: true
  - version: 15.0.0.10
  - versionstring: 15.0.0
  - edition: 
$ lsb_release -d
Description:    Ubuntu 16.04.5 LTS
$ uname -m
x86_64

]]>
https://matoken.org/blog/2018/12/12/failure-trying-to-upgrade-nextcloud-to-15/feed/ 0
特定プロセスのcpu利用率を制限するcpulimitを試す https://matoken.org/blog/2018/11/04/try-cpulimit-to-limit-cpu-utilization-of-specific-process/ https://matoken.org/blog/2018/11/04/try-cpulimit-to-limit-cpu-utilization-of-specific-process/#comments Sat, 03 Nov 2018 23:02:24 +0000 http://matoken.org/blog/?p=2210

先日mysqldump + xz 圧縮の間に pv を挟んで帯域制限をして xz の負荷を下げました.

しかしこの方法ではそんなに負荷がない mysqldump もずっと動かしっぱなしで db にもよろしく無いです.mysqldump は先に済ませて xz だけを制限することにします.

before
umask 0266 && nice -n 19 ionice -c 3 /usr/bin/mysqldump --defaults-file=/mnt/backup/micro/.my-backup.cnf --single-transaction --quick --all-databases --events | pv -L 128k 2>/dev/null | nice -n 19 ionice -c 3 /usr/bin/xz -9 > /mnt/backup/micro/`date +\%F_\%T_$$`.sql.xz
after
DUMP="/mnt/backup/micro/`date +\%F_\%T_$$`.sql"; umask 0266 && nice -n 19 ionice -c 3 /usr/bin/mysqldump --defaults-file=/mnt/backup/micro/.my-backup.cnf --single-transaction --quick --all-databases --events > ${DUMP} && pv -L 128k nice -n 19 ionice -c 3 /usr/bin/xz -9 > ${DUMP}.xz && rm ${DUMP}

一応動くけどcrontabなので1行で書いてあって見にくいしあまりいけてないですね.
せめてファイルに分けたほうが良さそう.

LimitCPU

pvでもいいのですが,cpu利用率を制限できないかなと思いました.xzのオプションでは見当たらずLinux環境なので cgroups で制限しようかとも思ったのですが, LimitCPU というものを見つけました.これは SIGSTOPSIGCONT のPOSIXシグナルをプロセスに送信することにより実現しているので,POSIX環境ならどこでも動きそうなのでこちらを試してみました.

LimitCPUはメンテされなくなったCPUlimitのフォークでコマンドやパッケージ名は cpulimit です.(混乱する><)

導入
$ sudo apt install cpulimit
usage
$ cpulimit -h
CPUlimit version 2.1
Usage: cpulimit TARGET [OPTIONS...] [-- PROGRAM]
   TARGET must be exactly one of these:
      -p, --pid=N        pid of the process
      -e, --exe=FILE     name of the executable program file
                         The -e option only works when
                         cpulimit is run with admin rights.
      -P, --path=PATH    absolute path name of the
                         executable program file
   OPTIONS
      -b  --background   run in background
      -c  --cpu=N        override the detection of CPUs on the machine.
      -l, --limit=N      percentage of cpu allowed from 1 up.
                         Usually 1 - 200, but can be higher
                         on multi-core CPUs (mandatory)
      -q, --quiet        run in quiet mode (only print errors).
      -k, --kill         kill processes going over their limit
                         instead of just throttling them.
      -r, --restore      Restore processes after they have
                         been killed. Works with the -k flag.
      -s, --signal=SIG   Send this signal to the watched process when cpulimit exits.
                         Signal should be specificed as a number or
                         SIGTERM, SIGCONT, SIGSTOP, etc. SIGCONT is the default.
      -v, --verbose      show control statistics
      -z, --lazy         exit if there is no suitable target process,
                         or if it dies
          --             This is the final CPUlimit option. All following
                         options are for another program we will launch.
      -h, --help         display this help and exit

制限はプロセスIDでの制限,プログラム名での制限,指定したプログラムを制限することが可能です.
cpuが複数ある場合は -l の値はcpu 1つあたり100として,100 * cpu数 を元に指定します.cpu 2つで 50% 利用したい場合は -l 100 になると思います.

プロセスID 1234 のプログラムをcpuを2つ利用,cpuを50%(2コアなので実際は100%分)
$ cpulimit -c 2 -p 1234 -l 50
xzというプログラムをcpu利用率を25%に制限
$ cpulimit -c 2 -l 50 - xz

※xzの前の - はなくてもいいが cpulimit のオプションの最後を示す.

cpuを1つだけ利用.cpu利用率を25%に制限しつつxzを実行できます.
$ cpulimit -c 1 -l 25 -z -  xz -9 datafile
  • -c : 利用するcpu数

  • -p : 制限するプロセスID

  • -l : 制限するcpu利用率

  • -z : 指定したプロセスが完了したらcpulimitも終了する(通常は関しを続けて同じ条件に一致するプロセスが現れたら制限する)

今回はxzを制限したいのでこんな感じに.
あまり変わりませんね…….

DUMP="/mnt/backup/micro/`date +\%F_\%T_$$`.sql"; umask 0266 && nice -n 19 ionice -c 3 /usr/bin/mysqldump --defaults-file=/mnt/backup/micro/.my-backup.cnf --single-transaction --quick --all-databases --events > ${DUMP} && nice -n 19 ionice -c 3 cpulimit -c1 -l 25 - /usr/bin/xz -9 ${DUMP}

バックアップ専用ユーザとして分けてあるのでそのユーザで cpulimit -c 1 -l 25 - xz とかしてxzという名前のプロセスを全部制限してしまうのもありかもしれません.monit とかで監視させればいい感じかも?そうすると,

DUMP="/mnt/backup/micro/`date +\%F_\%T_$$`.sql"; umask 0266 && nice -n 19 ionice -c 3 /usr/bin/mysqldump --defaults-file=/mnt/backup/micro/.my-backup.cnf --single-transaction --quick --all-databases --events > ${DUMP} && /usr/bin/xz -9 ${DUMP}

あまり変わりませんね…….

環境
$ dpkg-query -W cpulimit xz-utils
cpulimit        2.2-1
$ lsb_release -d
Description:    Ubuntu 16.04.5 LTS
$ uname -m
x86_64
]]>
https://matoken.org/blog/2018/11/04/try-cpulimit-to-limit-cpu-utilization-of-specific-process/feed/ 1
Debian, Ubuntu で 上流のパッケージを借りてくる https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/ https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/#comments Tue, 23 Oct 2018 14:10:12 +0000 http://matoken.org/blog/?p=2190

以前以下のような記事を書きました.

今でもこのblogの中ではアクセスが多く,最近もトラックバックをもらいました.

この当時は arm64 の mozcパッケージがなくて自分でbuild したという話なのですが,現在はDebian では buster(testing), Ubuntu ではartful(17.10) 以降でパッケージが存在します.
なのでこの野良パッケージを使うよりも公式の上流パッケージを借りるほうが大抵の場合いいと思います.
ということで手順を書いておきます.

パッケージファイルだけが必要な場合はパッケージのページからダウンロード可能です.

野良パッケージは近日中に削除します.

Debian stretch arm64 に Debian buster arm64 の mozc を借りてくる

Debian stretch arm64 では mozc-data しかない
$ apt-cache search mozc
mozc-data - Mozc input method - data files

buster(testing) のmozc を借りてくることにする.

/etc/apt/preferences で buster の優先度を下げる

/etc/apt/preferences
Package: *
Pin: release n=buster
Pin-Priority: 100
/etc/apt/sources.list に buster(testing)追加 設定
deb http://deb.debian.org/debian buster main

sources.list の編集には apt edit-sources を使うと文法チェックをしてくれるのでおすすめ

パッケージ情報の更新
$ sudo apt update
mozcパッケージの確認
$ apt-cache search mozc
mozc-data - Mozc input method - data files
fcitx-dbus-status - Addon for Fcitx to set/get/monitor IM statuses via D-Bus
emacs-mozc - Mozc for Emacs
emacs-mozc-bin - Helper module for emacs-mozc
fcitx-mozc - Mozc engine for fcitx - Client of the Mozc input method
ibus-mozc - Mozc engine for IBus - Client of the Mozc input method
mozc-server - Server of the Mozc input method
mozc-utils-gui - GUI utilities of the Mozc input method
uim-mozc - Mozc engine for uim - Client of the Mozc input method
パッケージの導入
$ apt install fcitx-mozc -t buster

後は通常の apt update && apt upgrade で stretch で導入したパッケージは stretch で,buster で導入したパッケージはbuster で更新されるはず.

Ubuntu 16.04 LTS xenial arm64 に Ubuntu 18.04 LTS bionic arm64 の mozc を借りてくる

Debianの手順と同じでもokだと思うけど念の為以下の手順を真似してみる.

mozc は Ubuntu 17.10 artful から対応しているが,もうサポートされないのでUbuntu 18.04 bionic を使う.

標準のリリースを xenial に設定

/etc/apt/apt.conf.d/01ubuntu
APT::Default-Release "xenial";

mozc をpinningする

/etc/apt/preferences
Package: *mozc*
Pin: release n=xenial
Pin-Priority: -10

Package: *mozc*
Pin: release n=bionic
Pin-Priority: 900

/etc/apt/sources.list に buster(testing) を 追加 設定

/etc/apt/sources.list
deb http://ports.ubuntu.com/ bionic main universe

※sources.list の編集には apt edit-sources を使うと文法チェックをしてくれるのでおすすめ
※mirrorにより arm64 が置かれていないので注意

パッケージ情報の更新
$ sudo apt update
検索結果にmozcが出てくる
$ apt-cache search mozc
mozc-data - Mozc input method - data files
ibus-mozc - Mozc engine for IBus - Client of the Mozc input method
mozc-server - Server of the Mozc input method
mozc-utils-gui - GUI utilities of the Mozc input method
emacs-mozc - Mozc for Emacs
emacs-mozc-bin - Helper module for emacs-mozc
fcitx-mozc - Mozc engine for fcitx - Client of the Mozc input method
uim-mozc - Mozc engine for uim - Client of the Mozc input method
パッケージの導入
$ sudo apt install fcitx-mozc -t bionic
]]>
https://matoken.org/blog/2018/10/23/debian-ubuntu-borrows-the-upstream-package/feed/ 2
mysqldump を pv で制限 https://matoken.org/blog/2018/10/11/mysqldump-limit-by-pv/ https://matoken.org/blog/2018/10/11/mysqldump-limit-by-pv/#comments Wed, 10 Oct 2018 21:40:22 +0000 http://matoken.org/blog/?p=2176

mysqldump 動いてる時間に同サーバで GNU social とか Nextcloud とかの mysql を利用しているアプリケーションが重くて使い物にならないです.nice + ionice は指定していますが効いてない感じ.
dump した sql を圧縮している xz コマンドが cpu を1 core 使い潰しているようです.このマシンは2 core あるのですが,もう1つの core もその他の処理でほぼ使い切って待ちが出ているような感じ.

$ vmstat 1 10
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0 328212 264788 212260 5628192    1    2    35   160    2   15 35  9 44 12  0
 1  1 328212 259136 212264 5628192    0    0     0   191 1497 3132 63  6 19 12  0
 1  1 328212 252492 212264 5628192    0    0     0    88  959 1716 81  6  7  6  0
 2  1 328212 248264 212264 5628196    0    0     0   114  973 1887 85  3  7  5  0
 2  0 328212 242572 212264 5628196    0    0     0    85  972 1967 74  5 15  5  0
 4  0 328212 241664 212100 5624380    0    0     0    97 1106 4226 91  7  2  2  0
 2  1 328212 234268 212100 5624384    0    0     0   140 1013 1815 70  5 19  7  0
 3  0 328212 235760 211944 5620076    0    0     0  2461 1289 4063 94  4  1  0  0
 1  0 328212 229656 211944 5620080    0    0     0   110  953 1685 61  6 18 15  0
 1  0 328212 224616 211952 5620072    0    0     0   151  983 1683 84  2  8  6  0

pv -L で帯域絞ってみました.
cpu の様子を見ながらだんだん絞っていって 128k 迄絞ってやっと xz の cpu 25〜40% 位になりました.この状態だと普通に使える感じです.
しばらくこれで試してみます.

pv で帯域制限
$ time sh -c "nice -n 19 ionice -c 3 mysqldump --defaults-file=/backup/micro/.my-backup.cnf --single-transaction --quick
--all-databases --events | pv -L 128k 2>/dev/null | nice -n 19 ionice -c 3 xz -9 > /dev/null"

real 127m16.113s
user 34m30.508s
sys 0m23.428s
cronでの実行
$ sudo -u backup crontab -l | grep mysqldump
14 3 * * *     umask 0266 && nice -n 19 ionice -c 3 /usr/bin/mysqldump --defaults-file=/mnt/backup/micro/.my-backup.cnf --single-transaction --quick --all-databases --events | pv -L 128k 2>/dev/null | nice -n 19 ionice -c 3 /usr/bin/xz -9 > /mnt/backup/micro/`date +\%F_\%T_$$`.sql.xz
環境
$ dpkg-query -W mysql-client-5.7 pv xz-utils
mysql-client-5.7        5.7.23-0ubuntu0.16.04.1
pv      1.6.0-1
xz-utils        5.1.1alpha+20120614-2ubuntu2
$ lsb_release -d
Description:    Ubuntu 16.04.5 LTS
$ uname -m
x86_64
$ grep -m1 model\ name /proc/cpuinfo
model name      : AMD Athlon(tm) II Neo N36L Dual-Core Processor
]]>
https://matoken.org/blog/2018/10/11/mysqldump-limit-by-pv/feed/ 1
Nextcloud 14 の Telegram を使った2要素認証 https://matoken.org/blog/2018/09/19/two-factor-authentication-using-nextgram-14-telegram/ https://matoken.org/blog/2018/09/19/two-factor-authentication-using-nextgram-14-telegram/#comments Wed, 19 Sep 2018 13:40:51 +0000 http://matoken.org/blog/?p=2127

先日ファイル共有ソフトの Nextcloud 14がリリースされました.

新機能のうちSignal/Telegram/SMS による2要素認証のサポートが気になります.

Signal/Telegram/SMS 2FA support
A new 2-factor authentication provider named ‘gateway’ was introduced which allows users to use the secure messaging apps Signal and Telegram as well as various SMS gateways as second factor to secure their authentication.

SMSはplaySMS, websms.deを利用するようです.SignalもTelegramもセキュアなメッセージングサービスなのでこういう用途に向いていそうです.どちらも公式でLinux x86_64のデスクトップアプリが提供されています.アプリの出来は今の所Telegramのほうが上だと思います.Arm Linuxだと公式のものはないのですが,TelegramについてはCLIのアプリがあり,Raspberry Pi の Raspbian stretch でも要patchで動作しました.(Webアプリもあるのでそちらでも動作すると思うが未確認)

SMSはやったことがあるし,Telegram が使いやすい.てことでTelegramの設定をしてみました.まだ未実装な機能が多くちょっと面倒なのでメモしておきます.

Two-Factor Gateway の導入

Nextcloud 14に Two-Factor Gateway アプリを導入します.管理者アカウントで「アプリ」の「セキュリティ」から導入するのが楽でしょう.

導入するとNextcloudの「設定」の「セキュリティ」の中に「Message gateway second-factor auth」という項目が現れますが,設定が出来ません.

GitHubのドキュメントをみると未だ未実装の機能が多いようです.

Telegram Bot の作成

TOTPコードの送信する Telegram Bot を作成します.作成はTelegram のドキュメントを参照して作成します.

BotFather と会話してbot作成

BotFather という bot 管理用の bot が居るので,会話してbot を作成します.

アイコンちょっと怖い

44062365934 5aabe8f64d m

/newbot コマンドで新しい bot の作成が始まります.botの名前を効かれるので答えます.続いて bot の username を求められます.この username は最後に bot とつける必要があります.
成功するとアクセストークンが表示されるのでメモして次の手旬に移ります.以下の例では 640093430:AAFTa_pSAcKCZWeFoVDt-l7h7ewqzNe0Luo がトークンです.

Done! Congratulations on your new bot. You will find it at t.me/matoken_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.

Use this token to access the HTTP API:
640093430:AAFTa_pSAcKCZWeFoVDt-l7h7ewqzNe0Luo

For a description of the Bot API, see this page: https://core.telegram.org/bots/api

30910879338 4609b7a707
44781979421 aac86c72de

occ コマンドで Telegram bot のトークン設定

Nextcloud のインストールされている場所に Nextcloud 管理用の occ コマンドがあります.このコマンドで Telegram bot のトークンを設定します.
トークンの 640093430: 部分は省いてその後ろだけを入力します.

$ sudo -u www-data php ./occ twofactorauth:gateway:configure telegram
Please enter your Telegram bot token: AAFTa_pSAcKCZWeFoVDt-l7h7ewqzNe0Luo
Using AAFTa_pSAcKCZWeFoVDt-l7h7ewqzNe0Luo.
$ sudo -u www-data php ./occ twofactorauth:gateway:status
Signal gateway: not configured
SMS gateway: not configured
Telegram gateway: configured

ひとまずこれで管理者側の設定は終了です.

Telegram bot の chat_id を調べて登録する

ここからはNextcloud の利用アカウントでの操作になります.

Telegram
In order to receive authentication codes via Telegram, you first have to start a new chat with the bot set up by your admin.
Secondly, you have to obtain your Telegram ID via the ID Bot. Enter this ID to receive your verification code below.

You are not using Telegram for two-factor authentication at the moment. Enable

Telegram アプリを利用して,Telegram の bot から TOTPコードを受け取りたい Telegram アカウントに適当なメッセージを投げます.

@matoken hello

その後,Telegram API を利用してメッセージを取得して chat_id を調べます.
以下の例では 475721977 です.

$ curl https://api.telegram.org/bot640093430:AAHu9u_c12KC2PY8g22QZoA94u4tAJvxsvY/getUpdates | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   358  100   358    0     0    315      0  0:00:01  0:00:01 --:--:--   315
{
  "ok": true,
  "result": [
    {
      "update_id": 612249686,
      "message": {
        "message_id": 9,
        "from": {
          "id": 475721977,
          "is_bot": false,
          "first_name": "matoken",
          "username": "matoken",
          "language_code": "En"
        },
        "chat": {
          "id": 475721977,
          "first_name": "matoken",
          "username": "matoken",
          "type": "private"
        },
        "date": 1537282406,
        "text": "@matoken hello",
        "entities": [
          {
            "offset": 0,
            "length": 8,
            "type": "mention"
          }
        ]
      }
    }
  ]
}

試しに送信してみて Telegram アプリに bot からメッセージが飛んできたら chat id が正しいはず.

$ curl -X POST "https://api.telegram.org/bot640093430:AAHu9u_c12KC2PY8g22QZoA94u4tAJvxsvY" -d "chat_id=475721977&text=hello" | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   274  100   246  100    28    179     20  0:00:01  0:00:01 --:--:--   200
{
  "ok": true,
  "result": {
    "message_id": 15,
    "from": {
      "id": 640093430,
      "is_bot": true,
      "first_name": "matoken_bot",
      "username": "matoken_bot"
    },
    "chat": {
      "id": 475721977,
      "first_name": "matoken",
      "username": "matoken",
      "type": "private"
    },
    "date": 1537312183,
    "text": "hello"
  }
}

Nextcloud にログインして,「設定」→「セキュリティ」の下部に「Message gateway second-factor auth」という項目が出来ているので「Enable」を押す.

Telegram
In order to receive authentication codes via Telegram, you first have to start a new chat with the bot set up by your admin.
Secondly, you have to obtain your Telegram ID via the ID Bot. Enter this ID to receive your verification code below.

You are not using Telegram for two-factor authentication at the moment. Enable

以下のメッセージが表示されたら chat_id を入力して Verify します.

Enter your identification (e.g. phone number to start the verification):
 Verify

Telegram で TOTPコードが飛んで来るのでそれを入力したらOKです.
一旦ログアウトして試してみましょう.

Telegram 認証を試す

いつものようにユーザ名,パスワードで認証すると以下のような画面に遷移します.
「Authenticate via Telegram」を押します.

44781965201 94bd9ca33e

Telegram から認証コードが飛んでくるのでそれを入力して認証完了です.

30910872108 2d5e8c21eb

めんどくさい……

未だ手順が面倒で一般ユーザに試してくれと言える状態ではないですね.でも次のリリースあたりでは簡単になるんじゃないでしょうか.

環境

$ sudo -u www-data php ./occ app:list|grep twofactor_|grep :
  - twofactor_backupcodes: 1.3.1
  - twofactor_gateway: 0.9.0
  - twofactor_totp: 1.5.0
$ sudo -u www-data php ./occ -V
Nextcloud 14.0.0
$ lsb_release -d
Description:    Ubuntu 16.04.5 LTS
$ uname -m
x86_64
]]>
https://matoken.org/blog/2018/09/19/two-factor-authentication-using-nextgram-14-telegram/feed/ 1
HDDのS.M.A.R.Tから温度を取得して表示してくれるhddtemp https://matoken.org/blog/2018/07/18/hddtemp-which-obtains-temperature-from-s-m-a-r-t-of-hdd-and-displays-it/ https://matoken.org/blog/2018/07/18/hddtemp-which-obtains-temperature-from-s-m-a-r-t-of-hdd-and-displays-it/#respond Wed, 18 Jul 2018 12:18:25 +0000 http://matoken.org/blog/?p=2011 hddtempというコマンドを知りました.熱いし熱が気になる時期だしお手軽に温度を知れるのは良さそうと試してみました.

導入

$ sudo apt install hddtemp

help

$ hddtemp -h
 Usage: hddtemp [OPTIONS] [TYPE:]DISK1 [[TYPE:]DISK2]...
 
   hddtemp displays the temperature of drives supplied in argument.
   Drives must support S.M.A.R.T.
 
  TYPE could be SATA, PATA or SCSI. If omitted hddtemp will try to guess.
 
  -b   --drivebase   :  display database file content that allow hddtemp to
                        recognize supported drives.
  -D   --debug       :  display various S.M.A.R.T. fields and their values.
                        Useful to find a value that seems to match the
                        temperature and/or to send me a report.
                        (done for every drive supplied).
  -d   --daemon      :  run hddtemp in TCP/IP daemon mode (port 7634 by default.)
  -f   --file=FILE   :  specify database file to use.
  -F   --foreground  :  don't daemonize, stay in foreground.
  -l   --listen=addr :  listen on a specific interface (in TCP/IP daemon mode).
  -n   --numeric     :  print only the temperature.
  -p   --port=#      :  port to listen to (in TCP/IP daemon mode).
  -s   --separator=C :  separator to use between fields (in TCP/IP daemon mode).
  -S   --syslog=s    :  log temperature to syslog every s seconds.
  -u   --unit=[C|F]  :  force output temperature either in Celsius or Fahrenheit.
  -q   --quiet       :  do not check if the drive is supported.
  -v   --version     :  display hddtemp version number.
  -w   --wake-up     :  wake-up the drive if need.
  -4                 :  listen on IPv4 sockets only.
  -6                 :  listen on IPv6 sockets only.
 
Report bugs or new drives to <hddtemp@guzu.net>.
hddtemp version 0.3-beta15

デバイスを指定すると温度が取得できます./dev/sd[a-z]とか/dev/sd?とかも使えました.
/dev/sdd, /dev/sdeはS.M.A.R.Tを使えないUSBアダプタ経由で繋いでいるので取得できませんでした.

$ sudo hddtemp /dev/sda
/dev/sda: VB0250EAVER: 37°C
$ sudo hddtemp /dev/sda /dev/sdb
/dev/sda: VB0250EAVER: 38°C
/dev/sdb: Hitachi HDS5C3030ALA630: 39°C
$ sudo hddtemp /dev/sd?
/dev/sda: VB0250EAVER: 37°C
/dev/sdb: Hitachi HDS5C3030ALA630: 37°C
/dev/sdc: WDC WD30EZRX-00MMMB0: 40°C
/dev/sdd: WDC WD30EZRX-00DC0B0: S.M.A.R.T. not available
/dev/sde: TOSHIBA DT01ACA300: S.M.A.R.T. not available

デーモン化もできます.tcp 7634にアクセスると値が取得できます.

$ sudo hddtemp -d /dev/sda
$ nc localhost 7634
|/dev/sda|VB0250EAVER|37|C|

停止

$ pgrep hddtemp
11832
$ sudo kill 11832

複数デバイスも行けるけどそのままでは見にくいですね.

$ sudo hddtemp -d /dev/sd?
$ nc localhost 7634
|/dev/sda|VB0250EAVER|38|C||/dev/sdb|Hitachi HDS5C3030ALA630|39|C||/dev/sdc|WDC WD30EZRX-00MMMB0|41|C||/dev/sdd|WDC WD30EZRX-00DC0B0|NA|*||/dev/sde|TOSHIBA DT01ACA300|NA|*|
$ nc localhost 7634|sed -e 's/||/|\n|/g'
|/dev/sda|VB0250EAVER|37|C|
|/dev/sdb|Hitachi HDS5C3030ALA630|38|C|
|/dev/sdc|WDC WD30EZRX-00MMMB0|40|C|
|/dev/sdd|WDC WD30EZRX-00DC0B0|NA|*|
|/dev/sde|TOSHIBA DT01ACA300|NA|*|

S.M.A.R.Tの値を元にしているのでこのツールを使わず大抵の環境で入っているsmartctlでも良い気もします.

$ sudo smartctl -a /dev/sda|grep -i temp
190 Airflow_Temperature_Cel 0x0022   063   056   045    Old_age   Always       -       37 (Min/Max 31/43)
194 Temperature_Celsius     0x0022   037   044   000    Old_age   Always       -       37 (0 11 0 0 0)

環境

$ lsb_release -d
Description:    Ubuntu 16.04.4 LTS
$ uname -m
x86_64
$ dpkg-query -W hddtemp smartmontools
hddtemp 0.3-beta15-52
smartmontools   6.4+svn4214-1
]]>
https://matoken.org/blog/2018/07/18/hddtemp-which-obtains-temperature-from-s-m-a-r-t-of-hdd-and-displays-it/feed/ 0
StarDictからGoldenDictに移行した https://matoken.org/blog/2018/06/08/moved-from-stardict-to-goldendict/ https://matoken.org/blog/2018/06/08/moved-from-stardict-to-goldendict/#respond Fri, 08 Jun 2018 10:25:06 +0000 http://matoken.org/blog/?p=1920
  • StarDict
  • The original StarDict project has recently been removed from SourceForge due to copyright infringement reports. Most of the files were lost with the demise of the project.

    てことで後継のGoldenDictを試してみました.

    StarDictでは辞書は英辞郎(テキストデータ版)とstardict-dic-jaを利用していました.

    英辞郎の辞書は以下のページのscriptを利用してStarDict形式に変換しました.

    eiji2sd_20160307.zipの中のPerl版(eiji2sd-text.pl)を利用して変換後StarDictの辞書ディレクトリにコピーしていました.以下は古めのマシンで実行しているので30分近く変換に掛かっていますが,通常はもっと短い時間で終わると思います.

    $ unzip eiji2sd_20160307.zip
    $ time perl eiji2sd-text.pl ../EIJIRO-1444.TXT
    Now reading: yohimbine activation
    Sorting...
    Writing dictionary:  99% Zina
    Done.
    
    real    26m41.099s
    user    3m3.413s
    sys     0m7.541s
    $ sudo install -b -D -g root -o root -m 0444 ./* /usr/share/stardict/dic/eijiro/
    

    という状態でStarDictを利用していました.

    GoldenDictの導入

    20180511_17:05:38-1489

    GoldenDictをディストリビューションパッケージで導入します.

    $ sudo apt install goldendict
    

    GoldenDictの辞書設定

    導入したら早速起動して辞書の設定を行います.

    メニューバーの「編集」->「辞書」で辞書ウィンドウを起動.
    「ソース」タブの「ファイル」タブで「追加」ボタンを押し,辞書を追加します.GoldenDictもStarDictの辞書形式を利用できるのでStarDictの辞書ディレクトリを指定します.「/usr/share/stardict/dic」を指定しました.辞書データをGoldenDictの辞書ディレクトリに持っていってもokです.その場合は「`
    追加したあと「再帰」チェックボックスにチェックをし,「今すぐ再スキャン」ボタンを押します.上部の「辞書」タブで辞書が反映されているか確認します.

    20180511_20:05:16-26744

    一旦ウィンドゥを閉じて,利用したいスキャンポップアップ機能を試します.タスクトレイのGoldenDictアイコンを右クリックして,「スキャン ポップアップ」にチェックが入っているのを確認して,適当な文字列を選択してポップアップウィンドウで辞書引きが出来るのを確認します.

    20180511_17:05:24-20380

    このままではちょっとポップアップが出る頻度が多くてうっとおしいですし,日本語入力が基本的に不可能になってしまいます.タスクトレイアイコンでOn/Offが出来ますが面倒です.

    「編集」->「環境設定」の「スキャンポップアップ」タブの「すべての選択されたキーが押されているときのみポップアップを表示する」をチェックして有効にします.

    20180608_14:06:17-1723

    もう一つCtrl+c+cでもポップアップが表示されます.これは「ホットキー」タブの「クリップボードからの単語を翻訳するのに次のホットキーを使用します」が有効になっているためです.私はクリップボードへのコピー時につい2回cを押してこれを出してしまうので無効にしました.

    20180530_05:05:23-12855

    オンライン辞書の利用

    「編集」->「辞書」の「ソース」タブの「Wikipedia」タブでWikipediaを引けるようになります.しかし,プリセットを有効にしても使えません.

    20180511_18:05:19-17217

    「アドレス」のURLをhttp://からhttps://に修正することで使えるようになりました.これが案外便利です.

    20180511_18:05:40-14823shutter_18-05-11_19:35:24_001

    Wikipediaが便利なので「Webサイト」タブで「ニコニコ大百科」と「はてなキーワード」も追加してみましたが表示されるまでの時間がかかりすぎるし,ヘッダーなどでコンテンツが見えづらいのでちょっとこのままでは使えなさそうです.

    20180511_22:05:11-774120180511_23:05:11-26007

    環境

    Ubuntu 16.04 LTS arm64
    Debian sid amd64

    ]]>
    https://matoken.org/blog/2018/06/08/moved-from-stardict-to-goldendict/feed/ 0
    スワップファイルを作ってお手軽にスワップを増やす https://matoken.org/blog/2018/05/30/create-swap-files-and-easily-increase-swap/ https://matoken.org/blog/2018/05/30/create-swap-files-and-easily-increase-swap/#respond Wed, 30 May 2018 12:05:56 +0000 http://matoken.org/blog/?p=1915 RAMを大量に必要とするプログラムがあって遅くてもいいから一時的にスワップを増やしてやり過ごすことがあります.また,RAMの少ないマシンでディスクの構成をいじるのが面倒なときにもスワップファイルが使えます.ということで今回RAMが2GBでそこそこあるけど偶に使い切ってしまう(主にchromium!)のでスワップファイルを用意してみました.

    スワップファイルを作成します.今回は/var/tmp/swap.imgというファイルで2GB用意しました.

    $ sudo install -o root -g root -m 0600 /dev/null /var/tmp/swap.img
    $ sudo dd if=/dev/zero of=/var/tmp/swap.img bs=1M count=2048
    $ sudo mkswap /var/tmp/swap.img
    

    とりあえずスワップファイルをアドホックに有効にします.

    $ sudo swapon /var/tmp/swap.img 
    

    .スワップが増えています.

    $ swapon -s
    Filename                                Type            Size    Used    Priority
    /dev/zram0                              partition       254688  80024   5
    /dev/zram1                              partition       254688  80016   5
    /dev/zram2                              partition       254688  79940   5
    /dev/zram3                              partition       254688  79928   5
    /var/tmp/swap.img                       file            2097148 0       -1
    

    一時的に必要な場合はこれで良いのですが,恒久的に利用したい場合はこのままでは再起動後には有効になりません./etc/fstabに設定を書いて起動時に有効になるようにします.

    $ sudo vi /etc/fstab
    $ grep -i swap.img /etc/fstab 
    /var/tmp/swap.img     none    swap    sw      0       0
    

    一旦swapoffでスワップを無効にしてswapon -aでfatabの設定が有効か試します.swapon -afstabのスワップの設定を全て有効にします.

    $ sudo swapoff /var/tmp/swap.img
    $ sudo swapon -a
    $ swapon -s
    Filename                                Type            Size    Used    Priority
    /dev/zram0                              partition       254688  80020   5
    /dev/zram1                              partition       254688  80016   5
    /dev/zram2                              partition       254688  79940   5
    /dev/zram3                              partition       254688  79928   5
    /var/tmp/swap.img                       file            2097148 0       -1
    
    

    念のため再起動してスワップファイルが有効かも試せばOKです :)

    スワップファイルの利用はお手軽ですが,スワップパーティーションに比べると性能は少し落ちるので可能ならスワップパーティーションを利用したほうが良いです.RAMが増設できるならそれが一番です.

    環境

    $ dpkg-query -W mount
    mount   2.27.1-6ubuntu3.6
    $ lsb_release -d
    Description:    Ubuntu 16.04.4 LTS
    $ uname -m
    aarch64
    
    ]]>
    https://matoken.org/blog/2018/05/30/create-swap-files-and-easily-increase-swap/feed/ 0
    OpenJDK で JOSM https://matoken.org/blog/2018/03/14/josm-with-openjdk/ https://matoken.org/blog/2018/03/14/josm-with-openjdk/#respond Tue, 13 Mar 2018 23:02:35 +0000 http://matoken.org/blog/?p=1854 Javaで動作するOpenStreetMapエディタのJOSMをLinux上のOpenJDKで動かすメモです.
    Debian sid amd64 / Ubuntu 16.04 LTS ARM64 で確認しています.

    JOSMの入手

    JOSMを次のページから入手します.josm-tested.jar をよく使っています.

    OpenJDKインストール

    2015年12月くらいにはこんなメッセージが出ていて現在はJava 8以上が必要になっています.

    このバージョンのJavaはもうすぐサポート対象から外れます。 Java 8以上にアップグレードしてください!

    ここでは OpenJDK 8 を導入

    $ sudo apt install openjdk-8-jre
    

    javaの確認

    OpenJDK 8になっている.もし違うバージョンが表示されたら次の項目へ.

    $ java -version
    openjdk version "1.8.0_151"
    OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12)
    OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)
    

    javaが複数入っていてjavaコマンドの結果が想定しているバージョンではない場合切り替える

    OpenJDK 8の場合はここはスキップする.

    $ sudo update-alternatives --config java
    

    JOSM起動

    -Dawt.useSystemAAFontSettings=onはフォントのアンチエイリアスを有効にするオプション.LCDの場合onの代わりにlcd.

    $ java -jar -Dawt.useSystemAAFontSettings=on ./josm-latest.jar
    
    追記)
    他の環境だとこの辺のどれかが使えそう(未確認)

    ]]>
    https://matoken.org/blog/2018/03/14/josm-with-openjdk/feed/ 0
    mysqlのdatadirを変更したらapparmorに怒られて起動しなくなった https://matoken.org/blog/2018/02/18/i-changed-mysqls-datadir-and-it-got-scolded-by-apparmor-and-it-not-start/ https://matoken.org/blog/2018/02/18/i-changed-mysqls-datadir-and-it-got-scolded-by-apparmor-and-it-not-start/#respond Sun, 18 Feb 2018 09:52:17 +0000 http://matoken.org/blog/?p=1836 ディスクの都合でmysqlのデータの置き場所を変更しました.
    mysqldを停止して,データを移動して,シンボリックリンクも一応貼っておく.
    /etc/mysql/mysql.conf.d/mysqld.cnfでdatadirを変更.

    [mysqld]
    datadir         = /export/data/var/lib/mysql
    

    この状態でmysqlを起動するとこんな感じのエラーで起動しなくなってしまいました.

    2018-02-17T16:12:54.184655Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
    2018-02-17T16:12:54.184718Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
    2018-02-17T16:12:54.184734Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
    2018-02-17T16:12:54.785643Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
    2018-02-17T16:12:54.786151Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
    2018-02-17T16:12:54.786272Z 0 [ERROR] Failed to initialize builtin plugins.
    2018-02-17T16:12:54.786415Z 0 [ERROR] Aborting
    

    該当ファイルは一見問題無さそうに見えます.

    $ sudo ls -la /export/data/var/lib/mysql/ibdata1
    -rw-rw---- 1 mysql mysql 102760448  2月 18 05:15 /export/data/var/lib/mysql/ibdata1
    $ sudo -u mysql dd if=/export/data/var/lib/mysql/ibdata1 bs=10 count=1|od -xc
    1+0 レコード入力
    1+0 レコード出力
    10 bytes copied, 9.8366e-05 s, 102 kB/s
    0000000    2214    405b    0000    0000    0000
            024   "   [   @  \0  \0  \0  \0  \0  \0
    0000012
    

    何でだ?と思ったらkernel logにこんなログが.apparmorで引っかかっているようです.

    Feb 18 00:35:26 micro kernel: [ 3569.631324] audit: type=1400 audit(1518881726.300:24): apparmor="DENIED" operation="open" prof
    ile="/usr/sbin/mysqld" name="/proc/18795/status" pid=18795 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=114 ouid=114
    

    /etc/apparmor.d/usr.sbin.mysqldでパスを変更します.

    diff --git a/apparmor.d/usr.sbin.mysqld b/apparmor.d/usr.sbin.mysqld
    index 2619e7d..adb8259 100644
    --- a/apparmor.d/usr.sbin.mysqld   
    +++ b/apparmor.d/usr.sbin.mysqld
    @@ -46,16 +46,16 @@
       /usr/share/mysql/** r,  
    
     # Allow data dir access   
    -  /var/lib/mysql/ r,
    -  /var/lib/mysql/** rwk,  
    +  /export/data/var/lib/mysql/ r,  
    +  /export/data/var/lib/mysql/** rwk,
    
     # Allow data files dir access
    -  /var/lib/mysql-files/ r,
    -  /var/lib/mysql-files/** rwk,
    +  /export/data/var/lib/mysql-files/ r,
    +  /export/data/var/lib/mysql-files/** rwk,
    
     # Allow keyring dir access
    -  /var/lib/mysql-keyring/ r,
    -  /var/lib/mysql-keyring/** rwk, 
    +  /export/data/var/lib/mysql-keyring/ r,
    +  /export/data/var/lib/mysql-keyring/** rwk,
    
     # Allow log file access 
       /var/log/mysql.err rw,
    

    この状態でapparmorを再起動して設定を反映してからmysqlを起動でOKでした.

    $ sudo service apparmor restart
    $ sudo service mysql start
    

    この後iostat -xを眺めて大丈夫そうかなーって思ったのですがディスクアクセス音が大きくなったのでまた別の場所に移動するかも…….

    環境

    $ dpkg-query -W mysql-server
    mysql-server    5.7.21-0ubuntu0.16.04.1
    $ lsb_release -a
    Distributor ID: Ubuntu
    Description:    Ubuntu 16.04.3 LTS
    Release:        16.04
    Codename:       xenial
    $ uname -m
    x86_64
    

    ]]>
    https://matoken.org/blog/2018/02/18/i-changed-mysqls-datadir-and-it-got-scolded-by-apparmor-and-it-not-start/feed/ 0
    Linux ARM版Vivaldiを入れてみた https://matoken.org/blog/2017/12/07/i-put-the-linux-arm-version-vivaldi/ https://matoken.org/blog/2017/12/07/i-put-the-linux-arm-version-vivaldi/#comments Wed, 06 Dec 2017 21:32:30 +0000 http://matoken.org/blog/?p=1721 20171207_01:12:04-24154

    Operaの共同創設者でCEOだったJon Stephenson von Tetzchnerによって設立されたVivaldi Technologiesによって開発されているウェブブラウザがあります.
    これまでx86/x64プラットホームのWindows/macOS/Linux版が提供されていましたが,2017/12/05にLinux ARM版(armhf)がリリースされました.

    Raspberry PiのRaspbianがメインのようですが,他のARM環境でも試したら普通に動きました :)

    といってもやはりRAM512MBのようなマシンでは辛いですね.RAM2GBのマシンだと今のところいい感じそうです.Midoriやqutebrowserでうまく表示できないMastodonやgmail/Google+なども問題なく表示できますし,Chromeの拡張機能も使えます.

    Linux ARM版Vivaldiの入手と確認

    deb pkgダウンロード

    $ wget https://downloads.vivaldi.com/stable/vivaldi-stable_1.13.1008.34-1_armhf.deb
    

    hash

    hashとか見当たらないけど手元ではこんな感じだった

    $ md5sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
    7515f51385a9a264ad5bb7612438aeda  vivaldi-stable_1.13.1008.34-1_armhf.deb
    $ sha1sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
    6b103d205f6aa7a5f3b394ba8d32dc9ca87bf0cd  vivaldi-stable_1.13.1008.34-1_armhf.deb
    $ sha256sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
    e7af5d021bf0c2968fcf0271e8f741552e34bcf2d032318eb8ea95356067297d  vivaldi-stable_1.13.1008.34-1_armhf.deb
    $ sha512sum vivaldi-stable_1.13.1008.34-1_armhf.deb 
    f47f2d26e8045af9ba680129feca765cf3f9dc7ea76930071e9688ef50aa78a482b40ba5747fb4470d30520177bda371ec79e5a210a93dcf2e49251425001c6d  vivaldi-stable_1.13.1008.34-1_armhf.deb
    

    パッケージ情報確認

    $ dpkg-deb -I ./vivaldi-stable_1.13.1008.34-1_armhf.deb
     新形式 debian パッケージ、バージョン 2.0。
     サイズ 45154158 バイト: コントロールアーカイブ = 9840 バイト。
        1269 バイト、   16 行      control              
       15872 バイト、  442 行   *  postinst             #!/bin/sh
       12544 バイト、  324 行   *  postrm               #!/bin/sh
        1220 バイト、   42 行   *  prerm                #!/bin/sh
     Package: vivaldi-stable
     Version: 1.13.1008.34-1
     Architecture: armhf
     Maintainer: Vivaldi Package Composer <packager@vivaldi.com>
     Installed-Size: 131921
     Pre-Depends: dpkg (>= 1.14.0)
     Depends: gconf-service, libasound2 (>= 1.0.16), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.16), libcairo2 (>= 1.6.0), libcups2 (>= 1.4.0), libdbus-1-3 (>= 1.2.14), libexpat1 (>= 2.0.1), libfontconfig1 (>= 2.8.0), libgcc1 (>= 1:4.4.0), libgconf-2-4 (>= 3.2.5), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.28.0), libgtk-3-0 (>= 3.9.10), libnspr4 (>= 2:4.9-2~), libpango-1.0-0 (>= 1.14.0), libpangocairo-1.0-0 (>= 1.14.0), libx11-6 (>= 2:1.4.99.1), libx11-xcb1, libxcb1 (>= 1.6), libxcomposite1 (>= 1:0.3-1), libxcursor1 (>> 1.1.2), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxi6 (>= 2:1.2.99.4), libxrandr2 (>= 2:1.2.99.3), libxrender1, libxss1, libxtst6, ca-certificates, fonts-liberation, libnss3 (>= 3.26), xdg-utils (>= 1.0.2), wget
     Recommends: adobe-flashplugin, chromium-codecs-ffmpeg-extra
     Conflicts: vivaldi-beta, vivaldi-preview
     Replaces: vivaldi-beta, vivaldi-preview
     Provides: www-browser
     Section: web
     Priority: optional
     Homepage: https://vivaldi.com
     Description: A new browser for our friends
      Vivaldi browser is made with power users in mind by people who love the Web.
    

    導入

    とりあえずDebian jessie armhf/Ubuntu 16.04 LTS aarch64で動いている.

    Debian/Ubuntu等

    $ sudo dpkg -i ./vivaldi-stable_1.13.1008.34-1_armhf.deb
    

    以下のように依存パッケージが足りない場合は,

    dpkg: 依存関係の問題により vivaldi-stable:armhf の設定ができません:
     vivaldi-stable:armhf は以下に依存 (depends) します: libnss3 (>= 3.26)...しかし:
      パッケージ libnss3:armhf はまだインストールされていません。
    
    dpkg: パッケージ vivaldi-stable:armhf の処理中にエラーが発生しました (--install):
     依存関係の問題 - 設定を見送ります
    

    こんな感じで足りないpkgが入るはず.その後見送られていたvivaldi-stableの設定の続きも実行される.

    $ sudo apt install -f
    

    64bit ARM環境

    バージョン情報_009

    aarch64でも試した.
    既にadd archtecture armhfして色々入れていた環境に入れてクリーンな環境で検証していないけど多分こんな感じ.

    $ sudo dpkg --add-architecture armhf
    $ sudo apt update
    $ sudo dpkg -i ./vivaldi-stable_1.13.1008.34-1_armhf.deb
    $ sudo apt install -f
    

    —-追記—-
    クリーンなDragonBoard 410cにDebian stretch aarch64(lonaro)を入れた環境でも確認したがこの手順でokだった :)
    —-追記終わり—-

    .debが使えない環境

    deb以外の環境ではこんな感じで適当な場所に展開して動かせた.

    $ mkdir -p ~/opt/vivaldi
    $ ar p vivaldi-stable_1.13.1008.34-1_armhf.deb data.tar.xz | tar xJ -C ~/opt/vivaldi
    $ rm vivaldi-stable_1.13.1008.34-1_armhf.deb
    $ ~/opt/vivaldi/opt/vivaldi/vivaldi
    

    Slackwareだと以下のsctiptが使えそう(未確認)

    問題

    sandbox

    もし,こんなエラーが出たら

    $ ~/opt/vivaldi/opt/vivaldi/vivaldi
    [13021:13021:1205/215600.516642:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/matoken/opt/vivaldi/opt/vivaldi/vivaldi-sandbox is owned by root and has mode 4755.
    Aborted[This script will find the latest Vivaldi binary package, download it and repackage it into Slackware format.](https://gist.github.com/ruario/dcbba70da900dac68fcc883542ff7ace "This script will find the latest Vivaldi binary package, download it and repackage it into Slackware format.")
    

    こんな感じでオーナーとパーミッションを設定したらok.

    $ chmod 4755 ~/opt/vivaldi/opt/vivaldi/vivaldi-sandbox
    $ sudo chown root.root ~/opt/vivaldi/opt/vivaldi/vivaldi-sandbox
    

    若しくは --no-sandbox option

    $ ~/opt/vivaldi/opt/vivaldi/vivaldi --no-sandbox
    

    日本語豆腐問題

    20171206_06:12:20-506920171206_07:12:16-6600

    とりあえず適当な日本語フォント(今回はVLゴシック)を入れて,Vivaldiを再起動で直った.(Dejavuが入っていたので指定してみたけど直らなかった)

    $ sudo apt install fonts-vlgothic
    

    関連

    ]]>
    https://matoken.org/blog/2017/12/07/i-put-the-linux-arm-version-vivaldi/feed/ 3
    Python Boot CampテキストをUbuntu 16.04 LTSで試す https://matoken.org/blog/2017/10/20/try-python-boot-camp-text-with-ubuntu-16-04-lts/ https://matoken.org/blog/2017/10/20/try-python-boot-camp-text-with-ubuntu-16-04-lts/#respond Thu, 19 Oct 2017 16:45:24 +0000 http://matoken.org/blog/?p=1689 #kagolug 2017.10で告知のあった「Python Boot Camp in 鹿児島」で使う「Python Boot Campテキスト」を見るとLinuxはUbuntu 17.04 serverがターゲットになっている

    1. Pythonをはじめる前に — Python Boot Camp Text 2016.04.28 ドキュメント

    1.3.3. Linux (Ubuntu Server) での場合
    ここではLinuxとしてUbuntu 17.04にPython3.6をインストールする方法を説明します。

    LTSのDesktop使いたい人も居るだろうなとUbuntu 16.04 LTS arm64で一通り確認してみた

    「1.3.3. Linux (Ubuntu Server) での場合」のPython導入は以下のように3.5に変更

    $ sudo apt update && sudo apt upgrade -y
    $ sudo apt -y install python3.5 python3.5-dev python3.5-venv
    $ python3.5 -V
    Python 3.5.2

    「5.1.2. ファイルへの書き込み」でファイルの確認前にflushしないとファイルが空

    >>> f.flush()

    「5.1.5. 追記モードでの書き込み」でファイルの確認前にflushしないとファイルが更新されない

    >>> f.flush()

    後は問題無さそう

    Debianの場合もstable(stretch)では同じだと思う.Python 3.6はtesting(Buster)以降になるみたい(未確認)

    このチュートリアルはBeautifulSoupまでやるので例えばcalibrでニュースサイトをスクレイピングしてKindleに自動転送といったようなレシピも書けるようになりますね :)

    ]]>
    https://matoken.org/blog/2017/10/20/try-python-boot-camp-text-with-ubuntu-16-04-lts/feed/ 0
    speedtest.netがcliで利用できるspeedtest-cliを試す https://matoken.org/blog/2017/09/09/try_speedtest-cli/ https://matoken.org/blog/2017/09/09/try_speedtest-cli/#respond Fri, 08 Sep 2017 22:30:10 +0000 http://matoken.org/blog/?p=1649 九里 真夏 @orumin そういえば speedtest.net って Linux の CLI client もありますね。

    ってことでLinuxのcliで動くPython製のspeedtest-cliをちょっと試してみた.

    speedtest.netでの回線速度計測をcliで行えます.python製でpipとかで各種環境に導入可能.

    Debianだとjessie以降all, Ubuntuだと16.04LTS以降allにpkgもあるのでapt一発で入るし,Raspberry PiなどのARMアーキテクチャなんかでも問題なく動きました.

    規定値の動作はipからロケーション拾ってそこから近いサーバーで計測した結果を返すようです.
    自宅のipアドレスでの自動判定では静岡になってたので手動で計測サーバを変更して鹿児島と東京を試しました.

    help

    $ speedtest-cli -h
    usage: speedtest-cli [-h] [--bytes] [--share] [--simple] [--list]
    [--server SERVER] [--mini MINI] [--source SOURCE]
    [--timeout TIMEOUT] [--secure] [--version]
    
    Command line interface for testing internet bandwidth using speedtest.net.
    --------------------------------------------------------------------------
    https://github.com/sivel/speedtest-cli
    
    optional arguments:
    -h, --help show this help message and exit
    --bytes Display values in bytes instead of bits. Does not affect
    the image generated by --share
    --share Generate and provide a URL to the speedtest.net share
    results image
    --simple Suppress verbose output, only show basic information
    --list Display a list of speedtest.net servers sorted by
    distance
    --server SERVER Specify a server ID to test against
    --mini MINI URL of the Speedtest Mini server
    --source SOURCE Source IP address to bind to
    --timeout TIMEOUT HTTP timeout in seconds. Default 10
    --secure Use HTTPS instead of HTTP when communicating with
    speedtest.net operated servers
    --version Show the version number and exit

    規定値では自宅は静岡になっていて静岡サーバで計測する(実際は鹿児島)

    $ speedtest-cli
    Retrieving speedtest.net configuration...
    Retrieving speedtest.net server list...
    Testing from FreeBit (180.131.110.140)...
    Selecting best server based on latency...
    Hosted by ClickL Network (Shizuoka) [0.02 km]: 110.464 ms
    Testing download speed........................................
    Download: 2.07 Mbit/s
    Testing upload speed..................................................
    Upload: 0.92 Mbit/s

    日本のサーバを確認する

    $ speedtest-cli --list|grep -i japan
    14180) ClickL Network (Shizuoka, Japan) [0.02 km]
    8407) Allied Telesis Capital Corporation (Sagamihara, Japan) [111.58 km]
    6087) Allied Telesis Capital Corporation (Fussa-shi, Japan) [120.41 km]
    6508) at2wn (Yokohama, Japan) [125.30 km]
    7510) ASEINet (Tokyo, Japan) [141.71 km]
    12546) TB (Tokyo, Japan) [141.71 km]
    12511) h3zjp (Nerima, Japan) [142.66 km]
    8348) Foxcore-LS (Sodegaura, Japan) [167.71 km]
    7139) SoftEther Corporation (Tsukuba, Japan) [192.41 km]
    6368) gatolabo (Maibara, Japan) [194.62 km]
    6766) JAIST(ino-lab) (Nomi, Japan) [232.28 km]
    13641) NextechNetworkSolutions (Nara, Japan) [237.53 km]
    6476) rxy (individual) (Osaka, Japan) [264.80 km]
    8832) prize3046 (Ikeda, Japan) [269.86 km]
    8193) kamiari (Sendai, Japan) [427.67 km]
    7976) denpa893 (Hikari, Japan) [601.03 km]
    6405) Allied Telesis Capital Corporation (Misawa, Japan) [686.38 km]
    13568) KSL (Kagoshima, Japan) [820.38 km]
    811) GLBB Japan KK (Chatan, Japan) [1397.84 km]
    6581) haza (Haebaru, Japan) [1410.56 km]

    鹿児島サーバで計測してみる

    $ speedtest-cli --server 13568
    Retrieving speedtest.net configuration...
    Retrieving speedtest.net server list...
    Testing from FreeBit (180.131.110.140)...
    Hosted by KSL (Kagoshima) [820.38 km]: 103.499 ms
    Testing download speed........................................
    Download: 2.20 Mbit/s
    Testing upload speed..................................................
    Upload: 0.92 Mbit/s

    東京を–simple optionで計測してみる

    $ speedtest-cli --simple --server 7510
    Ping: 150.627 ms
    Download: 1.88 Mbit/s
    Upload: 0.84 Mbit/s

    サーバの数を確認してみる

    $ speedtest-cli --list | wc -l
    6509

    speedtestはJavaScriptやAdobe Flashが必要なことが多くてヘッドレス環境などでは面倒でした.
    iperfやnetcatなんかはお手軽ですが,速度テスト先のサーバの用意が必要です.

    今回のspeedtest-cliはお手軽に導入できて世界各地のサーバ相手にcliでspeed testも出来ていい感じです.

    ]]>
    https://matoken.org/blog/2017/09/09/try_speedtest-cli/feed/ 0
    Ubuntu 16.04 aarch64環境でmozc pkgが無いのでsource pkgからbuild https://matoken.org/blog/2017/06/02/ubuntu-16-04-since-there-is-no-mozc-pkg-in-the-aarch64-environment-build-from-source-pkg-to-build/ https://matoken.org/blog/2017/06/02/ubuntu-16-04-since-there-is-no-mozc-pkg-in-the-aarch64-environment-build-from-source-pkg-to-build/#comments Thu, 01 Jun 2017 22:10:45 +0000 http://matoken.org/blog/?p=1611 EDIT: 現在は次の記事の手順のほうが良いと思います -> Debian, Ubuntu で 上流のパッケージを借りてくる – matoken’s meme

     

    最近Ubuntu 16.04 aarch64のi3 wmにモニタとキーボードを繋いでデスクトップ利用を試しています.しかし,日本語入力のためのmozcのバイナリパッケージが見当たりません.確認すると,xenialからartfulではi386/amd64/armhfのみの対応.

    Debianではarmelも対応していますが,arm64はやっぱりありません.

    armhf/armelで動いているならarm64もあまり悩まずソースパッケージからbuildできるのではと試してみました.

    #dpkg –add-archtecture armhfしてMultiarchにしてarmhfのMozcを使うという手でも行けそうな気はする.(未確認)

    環境構築

    必要なパッケージの導入と,ソースパッケージの入手を行います.

    $ sudo apt update
    $ sudo apt upgrade
    $ sudo apt install build-essential devscripts
    $ sudo apt build-dep fcitx-mozc
    $ apt source fcitx-mozc
    
    • apt build-depは指定したパッケージをbuildするのに必要なパッケージを導入できます.
    • apt sourceは指定したパッケージのソースパッケージを導入して展開してくれます.

    ※もしソースパッケージが見つからない場合はsource.listにdeb-srcの行があるか確認してみてください.無ければapt edit-sourcesコマンドで/etc/apt/source.listファイルを編集してdeb-srcを有効にしてください.以下のページが参考になると思います.

    Archtectureにarm64を追加してバイナリパッケージ作成

    次にソースディレクトリに降りて,debian/controlファイルを開き,必要なパッケージのArchtectureにarm64を登録します.mozc-dataはallなのでそのままにしておきます.(はじめarm64をaarch64にしてうまく行かなかったですorz)

    $ cd mozc-2.17.2116.102+gitfd0f5b34+dfsg
    $ cp debian/control debian/control.org
    $ vi debian/control
    $ diff -u debian/control.org debian/control
    --- debian/control.org  2017-05-30 17:06:44.000000000 +0000  
    +++ debian/control      2017-05-30 17:07:19.000000000 +0000  
    @@ -28,7 +28,7 @@                                            
      This open-source project originates from Google Japanese Input.
                                  mozc-data                               
     Package: ibus-mozc                                          
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, mozc-data,     
            ibus (>= 1.2), mozc-server (= ${binary:Version}), tegaki-zinnia-japanese
     Recommends: mozc-utils-gui (= ${binary:Version})            dpkg-buildpackage
    @@ -45,7 +45,7 @@                                            
      This open-source project originates from Google Japanese Input.
                                    mozc-data                             
     Package: fcitx-mozc                                         
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, fcitx-bin, fcitx-data, fcitx-modules,
            mozc-server (= ${binary:Version}), mozc-data, tegaki-zinnia-japanese
     Recommends: fcitx, mozc-utils-gui (= ${binary:Version})     
    @@ -64,7 +64,7 @@                                            
      fcitx-mozc provides client part of the Mozc input method.  
    
     Package: emacs-mozc                                         
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, emacs | emacs23 | emacs24, emacs-mozc-bin (= ${binary:Version})
     Conflicts: emacsen-common (<< 2.0.0)                        
     Description: Mozc for Emacs                                 
    @@ -76,7 +76,7 @@                                            
      This open-source project originates from Google Japanese Input.
    
     Package: emacs-mozc-bin                                     
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, mozc-server (= ${binary:Version})
     Description: Helper module for emacs-mozc                   
      Mozc is a Japanese Input Method Editor (IME) designed for multi-platform
    @@ -87,7 +87,7 @@                                            
      This open-source project originates from Google Japanese Input.
    
     Package: mozc-server                                        
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}                 
     Multi-Arch: foreign                                         
     Description: Server of the Mozc input method                
    @@ -99,7 +99,7 @@                                            
      This open-source project originates from Google Japanese Input.
    
     Package: mozc-utils-gui                                     
    -Architecture: i386 amd64 armel armhf                        
    +Architecture: i386 amd64 armel armhf arm64                  
     Depends: ${misc:Depends}, ${shlibs:Depends}, mozc-data      
     Recommends: mozc-server (= ${binary:Version})               
     Suggests: ibus-qt
    

    次にdpkg-buildpackageコマンドでパッケージを作成します.手元のマシンではちょうど1時間ほどで終了しました.(あとで-j4とかすると30分ほどに)

    $ dpkg-buildpackage -us -uc
    $ ls ../*.debmozc-data
    ../emacs-mozc-bin_2.17.211archtecture6.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb  ../ibus-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb    ../mozc-utils-gui_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb
    ../emacs-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb      ../mozc-data_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_all.deb
    ../fcitx-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb      ../mozc-server_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb
    

    出来上がったパッケージの導入

    今回はfcitxを使っていたので,fcitx-mozcを導入しました.導入した後にログインしなおして,fcitx-config-gtkを起動するとMozcが登録されて利用できるようになりました. :)

    $ sudo apt-get install ../mozc-server_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb ../mozc-data_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_all.deb ../fcitx-mozc_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb ../mozc-utils-gui_2.17.2116.102+gitfd0f5b34+dfsg-1ubuntu1.1_arm64.deb 
    

    重かったり不具合が出るようならskkあたりにしようかと思っていましたが,現在このパッケージを1週間ほど利用して特に問題なく使えています.

    あまり推奨しませんが,私の作ったパッケージをしばらく以下においておきます.必要な方は試してみてください.(上の手順に + dhc -i + dpkg-buildpackage -j4したもの)

    ところでこれはどうすればいいのかな.Debianでも動作確認してバグレポでok?そしてUbuntuはSync mozc from Debian unstableを待つ感じ?

    ]]>
    https://matoken.org/blog/2017/06/02/ubuntu-16-04-since-there-is-no-mozc-pkg-in-the-aarch64-environment-build-from-source-pkg-to-build/feed/ 2
    Ubuntu 16.04 xenialのlightdmのログイン画面でユーザー名を表示しないようにする https://matoken.org/blog/2017/05/26/hide-lightdm-userlist-with-ubuntu-16-04-xenial/ https://matoken.org/blog/2017/05/26/hide-lightdm-userlist-with-ubuntu-16-04-xenial/#respond Thu, 25 May 2017 21:53:41 +0000 http://matoken.org/blog/?p=1607
    $ sudo cat << __EOF__ > /usr/share/lightdm/lightdm.conf.d/10_my.conf
    [SeatDefaults]
    # Hiding the user list.
    greeter-hide-users=true
    __EOF__
    $ cat /usr/share/lightdm/lightdm.conf.d/10_my.conf 
    [SeatDefaults]
    # Hiding the user list.
    greeter-hide-users=true
    $ sudo service lightdm restart
    
    ]]>
    https://matoken.org/blog/2017/05/26/hide-lightdm-userlist-with-ubuntu-16-04-xenial/feed/ 0
    Podcastが無くなって困る https://matoken.org/blog/2017/04/06/trouble-with-podcasts/ https://matoken.org/blog/2017/04/06/trouble-with-podcasts/#respond Wed, 05 Apr 2017 21:49:37 +0000 http://matoken.org/blog/?p=1590 現在Podcastをpodgetで取得して,

    2 * * * *       podget -s
    

    その中の新しいものだけをownCloudにコピーしてAndroidやPCで視聴しています.

    10 * * * *      cd ~mk/POD ; find . -mmin -2880 -type f | egrep -v 'm3u$|LOG\/' | rsync --delete --progress --files-from=- ~mk/POD/ /var/www/owncloud/data/matoken/files/podcast/; find /var/www/owncloud/data/matoken/files/podcast/ -ctime +7 -type f -print0 | xargs -0 rm ; find /var/www/owncloud/data/matoken/files/podcast/news/ -mmin +1`
    

    今日聞こうとしたらownCloud内のPodcastが0個になっていました.心当たりはUbuntu 14.04 LTSからUbuntu 16.04 LTSへのdist-upgrade.ownCloudは上げる前と後に動作確認してたんで他の部分が怪しいとログを見るとpodgetがエラーを吐いています.こんな感じ.

    $ podget -s
    /home/mk/.podget/podgetrc cannot be verified to be compatible with this version of podget.
    
    It is missing the version line that is included in configuration files created by newer versions of podget.
    
    Please create a new configuration file by running 'podget --create-config <FILENAME>',
    and then converting your old configuration to the new format.  Then move the new file
    in place of the old and podget will work as it used to.
    

    設定ファイルが使えなくなってるみたいですね.枯れてるのかと思ってたら結構変化があったようです.
    ちなみに更新前のバージョンがpodget 0.6.9-1で現在はpodget 0.7.9-1でした.

    てことで,設定ファイルの雛形を別の場所に書き出して,

    $ podget --create-config /tmp/podgetrc
    podget
    
    Configuration filename specified by -c or --create-config violates the following rules...
    
    Suggestion(s):
      1. Filenames should not include any directory configuration.
         Remove the directory configuration.
         If you need to specify a directory other than the default,
         use the -d or --dir_config command line options.
    
    Closing session.
    

    …….--dir_config付けて再度.

    $ podget --dir_config /tmp --create-config podgetrc
    podget
      Installing default user configuration file in /tmp/podgetrc
      Installing default server list configuration.
    
    Closing session.
    

    https://gist.github.com/1b5fba2e949409a87e1955e0c779b057

    diffを取ってみると設定項目自体はそう変わってない感じですが,設定値が大文字小文字が変わったりしています.
    比較しながら書き換えて叩くと動き始めたようです.

    $ podget
    podget
    
    
    Session directory not found, creating
    Session file not found.  Creating podget.18364 .
    
    -------------------------------------------------
    Category: tech                 Name: 電脳空間カウボーイズ
    
    Downloading feed index from http://feeds.feedburner.com/weblogs/csc
    2017-04-06 06:13:13 URL:http://feeds.feedburner.com/weblogs/csc [46549] -> "-" [1]
    
    Downloading csc_2017_design2.mp3 from http://onosendai.jp/csc
    2017-04-06 06:20:43 URL:http://onosendai.jp/csc/csc_2017_design2.mp3 [51781411/51781411] -> "/home/mk/POD/tech/電脳空間カウボーイズ/csc_2017_design2.mp3" [1]
    PLAYLIST: Adding tech/電脳空間カウボーイズ/csc_2017_design2.mp3 to /home/mk/POD/New-2017-04-06.m3u
    
    Downloading csc_2017_design1.mp3 from http://onosendai.jp/csc
    2017-04-06 06:25:04 URL:http://onosendai.jp/csc/csc_2017_design1.mp3 [37304885/37304885] -> "/home/mk/POD/tech/電脳空間カウボーイズ/csc_2017_design1.mp3" [1]
    PLAYLIST: Adding tech/電脳空間カウボーイズ/csc_2017_design1.mp3 to /home/mk/POD/New-2017-04-06.m3u
     :
    

    しかし,ダウンロード済みのファイルも取得しているような?
    新規のみの設定にしているつもりなんですが,初回は舐めちゃうのかな?2度目のときに確認してみます.

    # Force
    # 0 == Only download new material.
    # 1 == Force download all items even those you've downloaded before.
    FORCE=0
    

    とりあえず終わるまではsoundcloud辺りで聞いてます.

    その後2回目はちゃんと期待通りの動作するのを確認したのでcrontabに登録し直しました.

    ]]>
    https://matoken.org/blog/2017/04/06/trouble-with-podcasts/feed/ 0
    byobu+screenでfunctionkeyを無効にする https://matoken.org/blog/2016/09/16/to-disable-the-functionkey-in-byobu-screen/ https://matoken.org/blog/2016/09/16/to-disable-the-functionkey-in-byobu-screen/#respond Fri, 16 Sep 2016 08:42:19 +0000 http://matoken.org/blog/?p=1402 機能覚えてないし遠いしたまに間違って押して混乱したりするので無効にしました.
    Debian stretch amd64, Ubuntu 16.04 LTS amd64で確認.

    $ vi ~/.byobu/keybindings

    して

    source $BYOBU_PREFIX/share/byobu/keybindings/common

    の次の行頭で i して編集モードにした後
    Ctrl+a !(aは設定してあるescape key)する.
    するとこんなのが出てくるので,

    :source /usr/share/byobu/keybindings/f-keys.screen

    頭の : を消して

    source /usr/share/byobu/keybindings/f-keys.screen.disable

    を書いておく

    保存して起動しなおして反映.

    #viである必然性はないのでお好きなテキストエディタでどうぞ.
    #tmuxの場合はこっち~/.byobu/keybindings.tmuxになるのかな?(それとも byobu-select-backend で切り替えるとファイル名入れ替わる?)

    ]]>
    https://matoken.org/blog/2016/09/16/to-disable-the-functionkey-in-byobu-screen/feed/ 0
    コマンドラインからGooglecastにcast出来るcastnowを試す https://matoken.org/blog/2016/09/16/try-the-cast-can-castnow-from-the-command-line-to-googlecast/ https://matoken.org/blog/2016/09/16/try-the-cast-can-castnow-from-the-command-line-to-googlecast/#comments Fri, 16 Sep 2016 08:30:02 +0000 http://matoken.org/blog/?p=1399 見つけたので試してみました

    Debian stretch amd64, Ubuntu 16.04 LTS amd64で確認しています.

    $HOME以下にPATH通してnpmで導入しています./usr/local以下で良ければnpm install castnow -gだけでいいかも.

    $ sudo apt install npm nodejs-legacy
    $ echo 'PATH="$PATH":$HOME/node_modules/.bin' >> ~/.bashrc
    $ source ~/.bashrc
    $ npm install castnow

    入りましたがChromecastがみあたらない?

    $ castnow --help
     
    Usage: castnow [<media>, <media>, ...] [OPTIONS]
     
    Option                  Meaning
    --tomp4                 Convert file to mp4 during playback
    --device <name>         The name of the Chromecast device that should be used
    --address <ip>          The IP address or hostname of your Chromecast device
    --subtitles <path/url>  Path or URL to an SRT or VTT file
    --subtitle-scale <scale> Subtitle font scale
    --subtitle-color <color> Subtitle font RGBA color
    --myip <ip>             Your local IP address
    --quiet                 No output
    --peerflix-* <value>    Pass options to peerflix
    --ffmpeg-* <value>      Pass options to ffmpeg
    --type <type>           Explicitly set the mime-type (e.g. "video/mp4")
    --bypass-srt-encoding   Disable automatic UTF-8 encoding of SRT subtitles
    --seek <hh:mm:ss>       Seek to the specified time on start using the format hh:mm:ss or mm:ss
    --loop                  Loop over playlist, or file, forever
    --help                  This help screen
     
    Player controls
     
    Key                     Action
    space                   Toggle between play and pause
    m                       Toggle mute
    up                      Volume Up
    down                    Volume Down
    left                    Seek backward
    right                   Seek forward
    n                       Next in playlist
    s                       Stop playback
    quit                    Quit
     
    $ castnow
    Error: device not found

    名前解決が出来なかったようでipを指定するとcast出来ました.別のマシンでは通ったのでこのマシンがおかしいようです.

    $ avahi-browse -a -t -l -r
    + wlp3s0 IPv6 x201s                                         Remote Disk Management local
    + wlp3s0 IPv4 Chromecast-KagoLUG                            _googlecast._tcp     local
    = wlp3s0 IPv6 x201s                                         Remote Disk Management local
       hostname = [x201s.local]
       address = [fe80::222:faff:fe33:456a]
       port = [22]
       txt = []
    = wlp3s0 IPv4 Chromecast-KagoLUG                            _googlecast._tcp     local
       hostname = [Chromecast-KagoLUG.local]
       address = [192.168.2.206]
       port = [8009]
       txt = ["rs=" "bs=FA8FCA59198D" "st=1" "ca=4101" "fn=Chromecast-KagoLUG" "ic=/setup/icon.png" "md=Chromecast" "ve=05" "rm=A652B47431F36207" "id=7c14aaaa62a6002dd95ba94814e5c5e0"]
    $ castnow --address 192.168.2.206 http://commondatastorage.googleapis.com/gtv-videos-bucket/ED_1280.mp4
     
      State     : Playing....

    パイプも使えるので色々応用できそうな気がします.
    (最近Chromiumがamd64/i386しかなくなったようですが,これを使えば他のアーキテクチャでもスクリーンキャストもできそう?)

    ]]>
    https://matoken.org/blog/2016/09/16/try-the-cast-can-castnow-from-the-command-line-to-googlecast/feed/ 1